+Sun Apr 1 21:37:22 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkwidget.[ch] gtk/gtktypeutils.c gtk/gtk-boxed.defs:
+ Add boxed type for GtkRequistion. Use it for ::size-request.
+
+ * gtk/gtkstyle.[ch] gtk/gtktypeutils.c gtk/gtk-boxed.defs:
+ Add a new GtkBorder structure useful for geometry properties
+ for widgets. Add corresponding GTK_TYPE_BORDER.
+
+ * gtk/gtkwidget.c (gtk_widget_class_install_style_property):
+ Support automatic parser selection like
+ gtk_settings_install_property_parser().
+
+ * gtk/gtksettings.c (_gtk_rc_property_select_parser): Export
+ functionality for use by gtk_widget_class_install_style_property.
+ Support GTK_TYPE_BORDER, GTK_TYPE_REQUISITION.
+
+Sun Apr 1 20:48:59 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.c (gtk_entry_class_init): Make invisible-char
+ g_param_spec_unichar().
+
Sun Apr 1 23:41:37 2001 Tim Janik <timj@gtk.org>
* gdk/x11/gdkwindow-x11.c (gdk_window_focus): raise window for non
+Sun Apr 1 21:37:22 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkwidget.[ch] gtk/gtktypeutils.c gtk/gtk-boxed.defs:
+ Add boxed type for GtkRequistion. Use it for ::size-request.
+
+ * gtk/gtkstyle.[ch] gtk/gtktypeutils.c gtk/gtk-boxed.defs:
+ Add a new GtkBorder structure useful for geometry properties
+ for widgets. Add corresponding GTK_TYPE_BORDER.
+
+ * gtk/gtkwidget.c (gtk_widget_class_install_style_property):
+ Support automatic parser selection like
+ gtk_settings_install_property_parser().
+
+ * gtk/gtksettings.c (_gtk_rc_property_select_parser): Export
+ functionality for use by gtk_widget_class_install_style_property.
+ Support GTK_TYPE_BORDER, GTK_TYPE_REQUISITION.
+
+Sun Apr 1 20:48:59 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.c (gtk_entry_class_init): Make invisible-char
+ g_param_spec_unichar().
+
Sun Apr 1 23:41:37 2001 Tim Janik <timj@gtk.org>
* gdk/x11/gdkwindow-x11.c (gdk_window_focus): raise window for non
+Sun Apr 1 21:37:22 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkwidget.[ch] gtk/gtktypeutils.c gtk/gtk-boxed.defs:
+ Add boxed type for GtkRequistion. Use it for ::size-request.
+
+ * gtk/gtkstyle.[ch] gtk/gtktypeutils.c gtk/gtk-boxed.defs:
+ Add a new GtkBorder structure useful for geometry properties
+ for widgets. Add corresponding GTK_TYPE_BORDER.
+
+ * gtk/gtkwidget.c (gtk_widget_class_install_style_property):
+ Support automatic parser selection like
+ gtk_settings_install_property_parser().
+
+ * gtk/gtksettings.c (_gtk_rc_property_select_parser): Export
+ functionality for use by gtk_widget_class_install_style_property.
+ Support GTK_TYPE_BORDER, GTK_TYPE_REQUISITION.
+
+Sun Apr 1 20:48:59 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.c (gtk_entry_class_init): Make invisible-char
+ g_param_spec_unichar().
+
Sun Apr 1 23:41:37 2001 Tim Janik <timj@gtk.org>
* gdk/x11/gdkwindow-x11.c (gdk_window_focus): raise window for non
+Sun Apr 1 21:37:22 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkwidget.[ch] gtk/gtktypeutils.c gtk/gtk-boxed.defs:
+ Add boxed type for GtkRequistion. Use it for ::size-request.
+
+ * gtk/gtkstyle.[ch] gtk/gtktypeutils.c gtk/gtk-boxed.defs:
+ Add a new GtkBorder structure useful for geometry properties
+ for widgets. Add corresponding GTK_TYPE_BORDER.
+
+ * gtk/gtkwidget.c (gtk_widget_class_install_style_property):
+ Support automatic parser selection like
+ gtk_settings_install_property_parser().
+
+ * gtk/gtksettings.c (_gtk_rc_property_select_parser): Export
+ functionality for use by gtk_widget_class_install_style_property.
+ Support GTK_TYPE_BORDER, GTK_TYPE_REQUISITION.
+
+Sun Apr 1 20:48:59 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.c (gtk_entry_class_init): Make invisible-char
+ g_param_spec_unichar().
+
Sun Apr 1 23:41:37 2001 Tim Janik <timj@gtk.org>
* gdk/x11/gdkwindow-x11.c (gdk_window_focus): raise window for non
+Sun Apr 1 21:37:22 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkwidget.[ch] gtk/gtktypeutils.c gtk/gtk-boxed.defs:
+ Add boxed type for GtkRequistion. Use it for ::size-request.
+
+ * gtk/gtkstyle.[ch] gtk/gtktypeutils.c gtk/gtk-boxed.defs:
+ Add a new GtkBorder structure useful for geometry properties
+ for widgets. Add corresponding GTK_TYPE_BORDER.
+
+ * gtk/gtkwidget.c (gtk_widget_class_install_style_property):
+ Support automatic parser selection like
+ gtk_settings_install_property_parser().
+
+ * gtk/gtksettings.c (_gtk_rc_property_select_parser): Export
+ functionality for use by gtk_widget_class_install_style_property.
+ Support GTK_TYPE_BORDER, GTK_TYPE_REQUISITION.
+
+Sun Apr 1 20:48:59 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.c (gtk_entry_class_init): Make invisible-char
+ g_param_spec_unichar().
+
Sun Apr 1 23:41:37 2001 Tim Janik <timj@gtk.org>
* gdk/x11/gdkwindow-x11.c (gdk_window_focus): raise window for non
+Sun Apr 1 21:37:22 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkwidget.[ch] gtk/gtktypeutils.c gtk/gtk-boxed.defs:
+ Add boxed type for GtkRequistion. Use it for ::size-request.
+
+ * gtk/gtkstyle.[ch] gtk/gtktypeutils.c gtk/gtk-boxed.defs:
+ Add a new GtkBorder structure useful for geometry properties
+ for widgets. Add corresponding GTK_TYPE_BORDER.
+
+ * gtk/gtkwidget.c (gtk_widget_class_install_style_property):
+ Support automatic parser selection like
+ gtk_settings_install_property_parser().
+
+ * gtk/gtksettings.c (_gtk_rc_property_select_parser): Export
+ functionality for use by gtk_widget_class_install_style_property.
+ Support GTK_TYPE_BORDER, GTK_TYPE_REQUISITION.
+
+Sun Apr 1 20:48:59 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.c (gtk_entry_class_init): Make invisible-char
+ g_param_spec_unichar().
+
Sun Apr 1 23:41:37 2001 Tim Janik <timj@gtk.org>
* gdk/x11/gdkwindow-x11.c (gdk_window_focus): raise window for non
+Sun Apr 1 21:37:22 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkwidget.[ch] gtk/gtktypeutils.c gtk/gtk-boxed.defs:
+ Add boxed type for GtkRequistion. Use it for ::size-request.
+
+ * gtk/gtkstyle.[ch] gtk/gtktypeutils.c gtk/gtk-boxed.defs:
+ Add a new GtkBorder structure useful for geometry properties
+ for widgets. Add corresponding GTK_TYPE_BORDER.
+
+ * gtk/gtkwidget.c (gtk_widget_class_install_style_property):
+ Support automatic parser selection like
+ gtk_settings_install_property_parser().
+
+ * gtk/gtksettings.c (_gtk_rc_property_select_parser): Export
+ functionality for use by gtk_widget_class_install_style_property.
+ Support GTK_TYPE_BORDER, GTK_TYPE_REQUISITION.
+
+Sun Apr 1 20:48:59 2001 Owen Taylor <otaylor@redhat.com>
+
+ * gtk/gtkentry.c (gtk_entry_class_init): Make invisible-char
+ g_param_spec_unichar().
+
Sun Apr 1 23:41:37 2001 Tim Janik <timj@gtk.org>
* gdk/x11/gdkwindow-x11.c (gdk_window_focus): raise window for non
gtk_accel_group_ref
gtk_accel_group_unref)
+(define-boxed GtkBorder
+ gtk_border_copy
+ gtk_border_free
+ "sizeof(GtkBorder)")
+
(define-boxed GtkSelectionData
gtk_selection_data_copy
gtk_selection_data_free)
+(define-boxed GtkRequisition
+ gtk_requisition_copy
+ gtk_requisition_free
+ "sizeof(GtkRequisition)")
;;; Gdk boxed types
G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (gobject_class,
PROP_INVISIBLE_CHAR,
- g_param_spec_int ("invisible_char",
- _("Invisible character"),
- _("The character to use when masking entry contents (in \"password mode\")"),
- 0,
- G_MAXINT,
-
- '*',
- G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_param_spec_unichar ("invisible_char",
+ _("Invisible character"),
+ _("The character to use when masking entry contents (in \"password mode\")"),
+ '*',
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (gobject_class,
PROP_ACTIVATES_DEFAULT,
return class_n_properties;
}
+GtkRcPropertyParser
+_gtk_rc_property_parser_for_type (GType type)
+{
+ if (type == GTK_TYPE_GDK_COLOR)
+ return gtk_rc_property_parse_color;
+ else if (type == GTK_TYPE_REQUISITION)
+ return gtk_rc_property_parse_requisition;
+ else if (type == GTK_TYPE_BORDER)
+ return gtk_rc_property_parse_border;
+ else if (G_TYPE_FUNDAMENTAL (type) == G_TYPE_ENUM && G_TYPE_IS_DERIVED (type))
+ return gtk_rc_property_parse_enum;
+ else if (G_TYPE_FUNDAMENTAL (type) == G_TYPE_FLAGS && G_TYPE_IS_DERIVED (type))
+ return gtk_rc_property_parse_flags;
+ else
+ return NULL;
+}
+
void
gtk_settings_install_property (GtkSettings *settings,
GParamSpec *pspec)
g_return_if_fail (GTK_IS_SETTINGS (settings));
g_return_if_fail (G_IS_PARAM_SPEC (pspec));
- /* convenient automatic parser selection
- */
- if (G_PARAM_SPEC_VALUE_TYPE (pspec) == GTK_TYPE_GDK_COLOR)
- parser = gtk_rc_property_parse_color;
- else if (G_TYPE_FUNDAMENTAL (G_PARAM_SPEC_VALUE_TYPE (pspec)) == G_TYPE_ENUM &&
- G_TYPE_IS_DERIVED (G_PARAM_SPEC_VALUE_TYPE (pspec)))
- parser = gtk_rc_property_parse_enum;
- else if (G_TYPE_FUNDAMENTAL (G_PARAM_SPEC_VALUE_TYPE (pspec)) == G_TYPE_FLAGS &&
- G_TYPE_IS_DERIVED (G_PARAM_SPEC_VALUE_TYPE (pspec)))
- parser = gtk_rc_property_parse_flags;
-
+ parser = _gtk_rc_property_parser_for_type (G_PARAM_SPEC_VALUE_TYPE (pspec));
+
settings_install_property_parser (GTK_SETTINGS_GET_CLASS (settings), pspec, parser);
}
return success;
}
+
+static gboolean
+get_braced_int (GScanner *scanner,
+ gboolean first,
+ gboolean last,
+ gint *value)
+{
+ if (first)
+ {
+ g_scanner_get_next_token (scanner);
+ if (scanner->token != '{')
+ return FALSE;
+ }
+
+ g_scanner_get_next_token (scanner);
+ if (scanner->token != G_TOKEN_INT)
+ return FALSE;
+
+ *value = scanner->value.v_int;
+
+ if (last)
+ {
+ g_scanner_get_next_token (scanner);
+ if (scanner->token != '}')
+ return FALSE;
+ }
+ else
+ {
+ g_scanner_get_next_token (scanner);
+ if (scanner->token != ',')
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
+gtk_rc_property_parse_requisition (const GParamSpec *pspec,
+ const GString *gstring,
+ GValue *property_value)
+{
+ GtkRequisition requisition;
+ GScanner *scanner;
+ gboolean success = FALSE;
+
+ g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
+ g_return_val_if_fail (G_VALUE_HOLDS_BOXED (property_value), FALSE);
+
+ scanner = gtk_rc_scanner_new ();
+ g_scanner_input_text (scanner, gstring->str, gstring->len);
+
+ if (get_braced_int (scanner, TRUE, FALSE, &requisition.width) &&
+ get_braced_int (scanner, FALSE, TRUE, &requisition.height))
+ {
+ g_value_set_boxed (property_value, &requisition);
+ success = TRUE;
+ }
+
+ g_scanner_destroy (scanner);
+
+ return success;
+}
+
+gboolean
+gtk_rc_property_parse_border (const GParamSpec *pspec,
+ const GString *gstring,
+ GValue *property_value)
+{
+ GtkBorder border;
+ GScanner *scanner;
+ gboolean success = FALSE;
+
+ g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
+ g_return_val_if_fail (G_VALUE_HOLDS_BOXED (property_value), FALSE);
+
+ scanner = gtk_rc_scanner_new ();
+ g_scanner_input_text (scanner, gstring->str, gstring->len);
+
+ if (get_braced_int (scanner, TRUE, FALSE, &border.left) &&
+ get_braced_int (scanner, FALSE, FALSE, &border.right) &&
+ get_braced_int (scanner, FALSE, FALSE, &border.top) &&
+ get_braced_int (scanner, FALSE, TRUE, &border.bottom))
+ {
+ g_value_set_boxed (property_value, &border);
+ success = TRUE;
+ }
+
+ g_scanner_destroy (scanner);
+
+ return success;
+}
GtkRcPropertyParser parser);
/* --- precoded parsing functions --- */
-gboolean gtk_rc_property_parse_color (const GParamSpec *pspec,
- const GString *gstring,
- GValue *property_value);
-gboolean gtk_rc_property_parse_enum (const GParamSpec *pspec,
- const GString *gstring,
- GValue *property_value);
-gboolean gtk_rc_property_parse_flags (const GParamSpec *pspec,
- const GString *gstring,
- GValue *property_value);
+gboolean gtk_rc_property_parse_color (const GParamSpec *pspec,
+ const GString *gstring,
+ GValue *property_value);
+gboolean gtk_rc_property_parse_enum (const GParamSpec *pspec,
+ const GString *gstring,
+ GValue *property_value);
+gboolean gtk_rc_property_parse_flags (const GParamSpec *pspec,
+ const GString *gstring,
+ GValue *property_value);
+gboolean gtk_rc_property_parse_requisition (const GParamSpec *pspec,
+ const GString *gstring,
+ GValue *property_value);
+gboolean gtk_rc_property_parse_border (const GParamSpec *pspec,
+ const GString *gstring,
+ GValue *property_value);
/*< private >*/
void gtk_settings_set_property_value (GtkSettings *settings,
gdouble v_double,
const gchar *origin);
+GtkRcPropertyParser _gtk_rc_property_parser_for_type (GType type);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
edge, x, y, width, height);
}
+GtkBorder *
+gtk_border_copy (const GtkBorder *border)
+{
+ return (GtkBorder *)g_memdup (border, sizeof (GtkBorder));
+}
+
+void
+gtk_border_free (GtkBorder *border)
+{
+ g_free (border);
+}
+
/* Some forward declarations needed to rationalize the header
* files.
*/
+typedef struct _GtkBorder GtkBorder;
typedef struct _GtkStyle GtkStyle;
typedef struct _GtkStyleClass GtkStyleClass;
typedef struct _GtkThemeEngine GtkThemeEngine;
};
+struct _GtkBorder
+{
+ gint left;
+ gint right;
+ gint top;
+ gint bottom;
+};
+
GType gtk_style_get_type (void) G_GNUC_CONST;
GtkStyle* gtk_style_new (void);
GtkStyle* gtk_style_copy (GtkStyle *style);
gint height);
+GtkBorder *gtk_border_copy (const GtkBorder *border);
+void gtk_border_free (GtkBorder *border);
+
/* --- private API --- */
const GValue* _gtk_style_peek_property_value (GtkStyle *style,
GType widget_type,
else if (builtin_info[i].parent == GTK_TYPE_BOXED)
{
static const gchar *copy_types[] = {
- "GtkSelectionData", "GdkEvent", "GdkColor", "GtkTextIter", "PangoTabArray",
- "PangoFontDescription", "GtkTreeIter", "GtkTreePath",
+ "GtkSelectionData", "GdkEvent", "GdkColor", "GtkBorder", "GtkTextIter", "PangoTabArray",
+ "PangoFontDescription", "GtkTreeIter", "GtkTreePath", "GtkRequisition"
};
gboolean ref_counted = TRUE;
guint j;
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkWidgetClass, size_request),
- gtk_marshal_VOID__POINTER,
+ gtk_marshal_VOID__BOXED,
GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
- widget_signals[SIZE_ALLOCATE] =
+ GTK_TYPE_REQUISITION | G_VALUE_NOCOPY_CONTENTS);
+ widget_signals[SIZE_ALLOCATE] =
gtk_signal_new ("size_allocate",
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
gtk_widget_class_install_style_property (GtkWidgetClass *class,
GParamSpec *pspec)
{
- gtk_widget_class_install_style_property_parser (class, pspec, NULL);
+ GtkRcPropertyParser parser;
+
+ g_return_if_fail (GTK_IS_WIDGET_CLASS (class));
+ g_return_if_fail (G_IS_PARAM_SPEC (pspec));
+
+ parser = _gtk_rc_property_parser_for_type (G_PARAM_SPEC_VALUE_TYPE (pspec));
+
+ gtk_widget_class_install_style_property_parser (class, pspec, parser);
}
void
g_strreverse (*path_p);
}
}
+
+GtkRequisition *
+gtk_requisition_copy (const GtkRequisition *requisition)
+{
+ return (GtkRequisition *)g_memdup (requisition, sizeof (GtkRequisition));
+}
+
+void
+gtk_requisition_free (GtkRequisition *requisition)
+{
+ g_free (requisition);
+}
+
gchar **path,
gchar **path_reversed);
+GtkRequisition *gtk_requisition_copy (const GtkRequisition *requisition);
+void gtk_requisition_free (GtkRequisition *requisition);
+
#if defined (GTK_TRACE_OBJECTS) && defined (__GNUC__)
# define gtk_widget_ref gtk_object_ref
# define gtk_widget_unref gtk_object_unref